package com.yyj.jan.task;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.yyj.jan.user.entity.User;
import com.yyj.jan.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TopUserTask {

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    @Autowired()
    private UserService userService;
    @Scheduled(cron="0 15 3 * * ?") //表示每天下午3点3分执行定时任务
    public List<User> selectUserTop(){
        System.out.println("尼玛的" +"  " + dateFormat.format(new Date()));
        return  userService.findAll();
    }
}
